package SingleTon;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-03-08
 * Time: 23:27
 */
class Hungry{
    private static final Hungry hungry = new Hungry();

    public static Hungry getHungry() {
        return hungry;
    }

    private Hungry(){}
}

public class TestHungry {
    public static void main(String[] args) {
        Hungry hungry1 = Hungry.getHungry();
        Hungry hungry2 = Hungry.getHungry();
        System.out.println(hungry1);
        System.out.println(hungry2);
        System.out.println(hungry1 == hungry2);
    }
}
